<%-- 
    Document   : LoginProcess
    Created on : Feb 26, 2012, 2:49:25 AM
    Author     : Jaice
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.String" %>

<jsp:useBean id="formHandlerLogin" class="servlets.LoginServlet" scope="request">
    <jsp:setProperty name="formHandlerLogin" property="*"/>
</jsp:useBean>
<jsp:useBean id="SecprogScopeSession" class=
             "servlets.SecprogScopeSession" scope="session" />
<%
    if (formHandlerLogin.login()) {

        SecprogScopeSession.setUserName(formHandlerLogin.getUserName());
        SecprogScopeSession.setIsLogin(true);
        SecprogScopeSession.setAccounttype(formHandlerLogin.getAccounttype());
        //System.out.println(formHandlerLogin.getAccounttype());
        SecprogScopeSession.setSessionid(formHandlerLogin.getSessionid());
////////////////////////////////////////////////////////////
  SecprogScopeSession.setFullName(formHandlerLogin.getFullName());   
  SecprogScopeSession.setDatecreated(formHandlerLogin.getDatecreated());  
  SecprogScopeSession.setLastlogin(formHandlerLogin.getLastlogin());       
        

        if (SecprogScopeSession.getAccounttype() == 1) {
            response.sendRedirect("../customer/CMain.jsp");
        } else if (SecprogScopeSession.getAccounttype() == 2) {
            response.sendRedirect("../accounting/PCMain.jsp");
        } else if (SecprogScopeSession.getAccounttype() == 3 ||SecprogScopeSession.getAccounttype() == 4||SecprogScopeSession.getAccounttype() == 5||SecprogScopeSession.getAccounttype() == 6 ) {
            response.sendRedirect("../product/PMain.jsp");
        } else if (SecprogScopeSession.getAccounttype() == 10) {
            response.sendRedirect("../admin/AMain.jsp");
        }
    } else {
%><jsp:forward page="../login/retry.jsp"/><%         }
%>
